package com.dm0858.bianmin.ui.presenter;

import com.dm0858.bianmin.app.MyApp;
import com.dm0858.bianmin.mine.tools.LogUtils;
import com.dm0858.bianmin.model.response.ShangJiaResponse;
import com.dm0858.bianmin.ui.base.BasePresenter;
import com.dm0858.bianmin.view.IShangJiaView;
import com.socks.library.KLog;

import rx.Subscriber;

/**
 * Created by yelvqing on 2017/11/28.
 */

public class ShangJiaPresenter extends BasePresenter<IShangJiaView> {

    public ShangJiaPresenter(IShangJiaView view) {
        super(view);
    }

    public void getShangJia(String tid) {
        addSubscription(mApiService.getShangJia(tid, MyApp.userid), new Subscriber<ShangJiaResponse>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

                e.printStackTrace();
                KLog.e(e.getLocalizedMessage());
                mView.onError();
            }

            @Override
            public void onNext(ShangJiaResponse response) {

                mView.onGetShangJiaSuccess(response);
            }

        });
    }
}
